<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>评估单编辑</title>
		<link rel="stylesheet" type="text/css" href="../lib/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="../css/reset.css" />
		<link rel="stylesheet" type="text/css" href="evalution.css" />
	</head>
	<body>
		<div class="w70p">
		<h2>压疮Braden评估表</h2>
		<div id="view"></div>
		<script id="demo" type="text/html">
			<div class="tit">
				<span>姓名:{{ d.data.patName }}</span>
				<span>年龄:{{ d.data.patAge }}</span>
				<span>性别:{{ d.data.patSex }}</span>
				<span>科室:{{ d.data.wardName }}</span>
				<span>床号:{{ d.data.bedCode }}</span>
				<span>住院号:{{ d.data.admid }}</span>
			</div>
			<h2>{{d.data.patientEvaluationRecords.modules[0].categoryName}}</h2>
			{{#  layui.each(d.data.patientEvaluationRecords.modules[0].items, function(index, module){ }}
				
				<li>
					<span class="w20p">{{module.questionName}}</span>
					<!-- <span class="w20p">{{module.codeName}}</span> -->
					  {{#  layui.each(module.elements, function(index, element){ }}
						  <input type="radio" name="{{module.codeName}}" id="" value="{{element.itemValue}}" /><label for="">{{element.itemName}}</label>
					  {{#  }); }}
					  {{#  if(module.elements.length === 0){ }}
						无数据
					  {{#  } }} 
				</li>
			{{#  }); }}
			{{#  if(d.data.patientEvaluationRecords.modules[0].items.length === 0){ }}
			  无数据
			{{#  } }} 
			
			
			<h2>{{d.data.patientEvaluationRecords.modules[1].categoryName}}</h2>
			{{#  layui.each(d.data.patientEvaluationRecords.modules[1].items, function(index, module){ }}
				
				<li>
					<div class="questionname">{{module.questionName}}</div><br>
					<!-- <span class="w20p">{{module.codeName}}</span> -->
					  {{#  layui.each(module.elements, function(index, element){ }}
						  <input type="checkbox" name="{{module.codeName}}" id="" value="{{element.itemValue}}" /><label for="">{{element.itemName}}</label>
					  {{#  }); }}
					  {{#  if(module.elements.length === 0){ }}
						无数据
					  {{#  } }} 
				</li>
			{{#  }); }}
			{{#  if(d.data.patientEvaluationRecords.modules[1].items.length === 0){ }}
			  无数据
			{{#  } }} 
		</script>
		</div>
	</body>
	<script src="../js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<!-- <script src="add.js" type="text/javascript" charset="utf-8"></script> -->
	<script type="text/javascript">
		layui.use(['laypage', 'form', 'element', 'laytpl'], function() {
			var laytpl = layui.laytpl;
			var element = layui.element;
			var laypage = layui.laypage;
			var form = layui.form;



			var param = JSON.stringify({
				"body": {
					"patientId": 100108597,
					"entityId": 4,
					"templateId": 2
				},
				"header": {},
				"token": {}
			});
			$.ajax({
				'type': 'post',
				'url': '/service-nursing/evalution/patientEvaluation',
				'data': param,
				'dataType': 'json',
				'contentType': "application/json",
				'success': function(data) {
					console.log(data);
					var getTpl = demo.innerHTML,
						view = document.getElementById('view');
					laytpl(getTpl).render(data, function(html) {
						view.innerHTML = html;
					});
				},
				'error': function(res) {
					console.log(res);
				}
			});


		})
	</script>
</html>
